﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;

namespace AskPro.Models
{
    public class MyPrincipal : IPrincipal
    {
        private IIdentity identity;
        public DataContext.User DbUser { get; set; }

        public MyPrincipal(MyIdentity identity, DataContext.User dbUser)
        {
            this.identity = identity;
            this.DbUser = dbUser;
        }

        public IIdentity Identity
        {
            get { return this.identity; }
        }

        public bool IsInRole(string role)
        {
            throw new NotImplementedException();
        }
    }

    public class MyIdentity : IIdentity
    {
        public string AuthenticationType
        {
            get { return "CustoAuthentication"; }
        }

        private bool isAuthenticated;
        public bool IsAuthenticated
        {
            get { return this.isAuthenticated; }
        }

        private string name;
        public string Name
        {
            get { return this.name; }
        }

        public MyIdentity(bool isAuthenticated, string name)
        {
            this.isAuthenticated = isAuthenticated;
            this.name = name;
        }
    }
}